{literal}
    <script type="text/javascript">
    function checkForm()
    {
        var AudioChecked = jQuery('input[name="audios[]"]:checked').length;
        var PlaylistChecked = jQuery('input[name="playlist[]"]:checked').length;
            if(AudioChecked<=0){
                hideAllErrors();
                jQuery("#audioError").css("display","block");
                jQuery("#audioError").focus();   
                return false;
            }else if(PlaylistChecked<=0){
                hideAllErrors();
                jQuery("#playlistError").css("display","block");    
                jQuery("#playlistError").focus();   
                return false;
            }else{
                hideAllErrors();
            }
        return true;
    
    }

    function hideAllErrors() 
    {
        jQuery("#audioError").css("display","none");
        jQuery("#playlistError").css("display","none");    
        //document.getElementById("titleError").style.display = "none"
        
    }
        
    function checkCreatePlaylist()
    {
        title = document.getElementById("playlist_title").value;

        if (title == "")
        {
            hideAllPlaylistErrors();
            document.getElementById("titleError").style.display = "block";
            document.getElementById("playlist_title").select();
            document.getElementById("playlist_title").focus();
            return false;
        } 
        /*else{
            hideAllErrors();
            jQuery('#create_form').submit();
        }*/
        return true;

    }

    function hideAllPlaylistErrors() 
    {
        document.getElementById("titleError").style.display = "none"
    }    
    </script>
{/literal}
<div id="main_wrap">
    <div class="center_wrap clearfix">
        <h2 class="no_bottom no_top breadcrumb">
            <a>{$lang796}</a> &gt; {$showtitle}
        </h2>

        <div id="sidebar_wrap">
            <div id="list_cats">
                <a class="category-txt" href="{$baseurl}/categories/">
                    <img alt="Category" src="{$baseurl}/images/tjj_music_we_categories.jpg">
                </a>
                <ul id="ul_categories">
                    {insert name=get_audio_categories assign=listaudiocategories}
                    {section name=o loop=$listaudiocategories}
                        <li><a href="{$baseurl}/browse/categories/audios/z/{$listaudiocategories[o].CATID}/1/{$listaudiocategories[o].name|stripslashes}">{$listaudiocategories[o].name|stripslashes}</a></li>
                    {/section}
                </ul>
            </div>
            <div class="sky_ad">
                <center>
                    {insert name=get_advertisement value=var AID="2"}
                </center>
            </div>
        </div>

        <div class="right col1">
            {if $userPlaylists|@count gt '0' && $userID neq ''}
                <form method="POST" action="{$formAction}" id="playlistForm" name="playlistForm">
                {/if}       
                <div class="cat_box_full clearfix" id="browse_main"> 
                    <table width="100%" cellspacing="3" cellpadding="3" border="0">
                        <tr>
                            <td valign="top">
                                <h2>{$showtitle}</h2>
                                <div class="uerror" id="audioError">Error: Please select atleast one audio to add to the playlist.</div>
                            </td>
                        </tr>
                        {if $PlaylistMsg neq ""}
                            <tr>
                                <td>
                                    <div id="smsg" class="errorPage clearfix" style="">
                                        <h2 style="font-size:18px">{$PlaylistMsg}</h2>
                                    </div>
                                </td>
                            </tr>
                        {/if} 
                    </table>	

                    <div class="cat_body_full clearfix">

                        {if $error ne ""}
                            {include file="show_error.tpl"}
                        {/if}
                        {if $showmessage ne ""}
                            {include file="show_message.tpl"}
                        {/if}

                        <div id="browse_results">
                            <ul>
                                {section name=i loop=$listaudios}
                                    <li class="video">
                                        <div class="video_i">
                                            <a href="{$baseurl}/audios/{$listaudios[i].AUDIOID}/{insert name=get_seotitle_from_audioid assign=title audioid=$listaudios[i].AUDIOID}">
                                            {capture assign='player'}images/audiothumbs/{$listaudios[i].AUDIOID}-1{$listaudios[i].ext}{/capture} 
                                            {if $player|file_exists}
                                                <img class="imag" height="87" width="116" alt="{$listaudios[i].title|stripslashes}" src="{$athumburl}/{$listaudios[i].AUDIOID}-1{$listaudios[i].ext}" />
                                            {else}
                                                <img class="imag" height="87" width="116" alt="{$listaudios[i].title|stripslashes}" src="{$athumburl}/default.png" />
                                            {/if}
                                            {*<img class="imag" height="87" width="116" alt="{$listaudios[i].title|stripslashes}" src="{$athumburl}/{$listaudios[i].AUDIOID}-1{$listaudios[i].ext}" />*}
                                            {if $listaudios[i].featured eq '1'} 
                                                <div class="tag"><span class="featured">featured</span></div>
                                            {/if}
                                        </a>
                                        <a href="{$baseurl}/audios/{$listaudios[i].AUDIOID}/{insert name=get_seotitle_from_audioid assign=title audioid=$listaudios[i].AUDIOID}">
                                            <span class="artist_name">{$listaudios[i].title|stripslashes|truncate:15:"...":true}</span>
                                            <span class="song_name">{if $listaudios[i].artist neq ""}{$listaudios[i].artist|stripslashes|truncate:15:"...":true}{else}Anonymous{/if}</span>
                                        </a>
                                        {if $userPlaylists|@count gt '0' && $userID neq ''}   
                                            <span><input type="checkbox" name="audios[]" id="{$listaudios[i].AUDIOID}" value="{$listaudios[i].AUDIOID}" /> Add to playlist</span>
                                            {/if}
                                    </div>
                                    </il>
                                {/section}	
                        </ul>
                    </div> 
                </div>

                <div class="paginate">
                    {$pagelinks}
                </div>
            </div>
            {if $userPlaylists|@count gt '0' && $userID neq '' && $listaudios|@count gt '0'}
                <br />
                <div class="cat_box_full clearfix" id="browse_main"> 
                    <h2 style="padding-bottom:10px;">Playlists</h2>
                    <div class="uerror" id="playlistError">Error: Please select atleast one playlist to add audios to.</div>
                    {section name=i loop=$userPlaylists}
                        <div style="float:left;width:25%;">
                            <input type="checkbox" name="playlist[]" id="{$userPlaylists[i].id}" value="{$userPlaylists[i].id}" />&nbsp;
                            {$userPlaylists[i].title|truncate:15:"...":true}
                        </div>
                    {/section}
                    <div class="clear"></div>
                    <div>
                        <br />
                        <button id="addtoplaylist" name="addtoplaylist" type="submit" onCLick="return checkForm();">Add to playlist</button>
                    </div>
                </div>
            </form>
            <div class="cat_box_full clearfix" id="browse_main">        
                <h2 style="padding-bottom:10px;">Create new playlist</h2>
                {if $errorPlaylist neq ""}
                    <div id="smsg" class="errorPage clearfix" style="">
                        <h2 style="font-size:18px">{$errorPlaylist}</h2>
                    </div>

                {/if} 
                <form name="create_playlist" id="create_playlist"  method="POST">
                    <input type="hidden" value="1" name="new_playlist" id="new_playlist" />
                    <p>
                        <label for="title">Title:&nbsp;</label>
                        <input name="playlist_title" id="playlist_title" type="text" value="{$playlist_title|stripslashes}" size="30" /><br />
                    <div class="uerror" id="titleError">Error: Playlist title cannot be empty.</div>
                    </p>
                    <p>
                        <button onclick="return checkCreatePlaylist();" type="submit" name="create_button" id="addtoplaylist">Create playlist</button>
                        {*<input type="submit" name="create_button" id="upload_button" value="Create" onClick="return checkCreatePlaylist();" />*}
                    </p>        
                </form>
            </div>
        {/if}

    </div> {*right-col1 div ends here...*}
    <div class="clear"></div>
</div>
</div>
